package main
import "fmt"
func add(x,y int)int{
	sum:=x+y
	return sum
}

func sub(x,y int)int{
	ret:=x-y
	return ret	
}

//可变参参数的类型是切片类型
func Func(x ...int){
	fmt.Printf("%v-%T\n",x,x)
}

func addFunc(x ...int)int{
	var sum int=0
	for _,val:=range x{
		sum+=val
	}
	return sum
}

//
func calc(x,y int)(int,int){
	var sum int=x+y
	sub:=x-y
	return sum,sub
}


func calc1(x,y int)(sum,sub int){
	sum=x+y
	sub=x-y
	return 
}

func main(){
	var ret=add(30,20)
	fmt.Println(ret)
	ret=sub(30,20)
	fmt.Println(ret)
	Func(10,20,30,40)
	var addret int=addFunc(10,20,30,40,50)
	fmt.Println(addret)

	sum,sub:=calc(13,30)
	fmt.Printf("sum=%v sub=%v\n",sum,sub)

	sum,sub=calc1(45,56)
	fmt.Printf("sum=%d sub=%d\n",sum,sub)
	
}